#pragma GCC optimize("Ofast", "unroll-loops")
#include<bits/stdc++.h>
using namespace std; using ll = long long;
#define For(i, j, k) for ( int i = (j) ; i <= (k) ; i++ )
#define Fol(i, j, k) for ( int i = (j) ; i >= (k) ; i-- )
constexpr int mod = 1000000007;
inline void add(int &x) { x >= mod && ( x -= mod ); }
inline void sub(int &x) { x < 0 && ( x += mod ); }
inline int qpow(int x, int y) { int z = 1; while ( y ) y & 1 && ( z = (ll)z * x % mod ), ( y >>= 1 ) && ( x = (ll)x * x % mod ); return z; }
inline int inv(int x) { return qpow(x, mod - 2); }
using ull = unsigned long long;
int n, ans; char s[309]; vector < int > pos; bool a[309]; ull f, g, h;
inline bool chk()
{
	f = g = h = 1;
	For(i, 1, n) if ( a[i] ) f <<= 1, g = ( g >> 1 ) | f, h = ( h << 1 ) | g;
				 else        f >>= 1, g = ( g << 1 ) | f, h = ( h >> 1 ) | g;
	return h & 1;
}
int main()
{
	freopen("bracket.in", "r", stdin), freopen("bracket.out", "w", stdout);
	cin.tie(nullptr) -> sync_with_stdio(false);
	cin >> n; For(i, 1, n) cin >> s[i];
	if ( n & 1 ) return cout << "0\n", 0;
	For(i, 1, n) if ( s[i] == 'x' ) pos.push_back(i); else a[i] = s[i] == '(';
	For(i, 0, ( 1 << (int)pos.size() ) - 1)
	{
		For(j, 0, (int)pos.size() - 1) a[pos[j]] = i & ( 1 << j );
		if ( chk() ) ans++;
	}
	return cout << ans << '\n', 0;
}